package com.xpc.rpc.consumer.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.net.InetAddress;
import java.net.UnknownHostException;

@ConfigurationProperties(prefix = "xpc")
public class RpcConsumerConfig {


    /**
     * 注册地址
     */
    private String registerAddress;

    /**
     * 注册类型
     */
    private String registerType;

    /**
     * Netty监听端口
     */
    private Integer registerPort;

    /**
     * 服务名称
     */
    private String applicationName;

    /**
     * 项目服务的监听端口
     */
    private Integer serverPort;

    /**
     * 本机的IP地址
     */
    private String serverAddress;

    /**
     * 扫描的包路径
     */
    private String packageName;

    /**
     * 负载均衡类型
     */
    private String loadbalancerType;

    public String getLoadbalancerType() {
        return loadbalancerType;
    }

    public void setLoadbalancerType(String loadbalancerType) {
        this.loadbalancerType = loadbalancerType;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public RpcConsumerConfig() {
        try {
            this.serverAddress = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }

    public String getRegisterAddress() {
        return registerAddress;
    }

    public void setRegisterAddress(String registerAddress) {
        this.registerAddress = registerAddress;
    }

    public String getRegisterType() {
        return registerType;
    }

    public void setRegisterType(String registerType) {
        this.registerType = registerType;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public Integer getRegisterPort() {
        return registerPort;
    }

    public void setRegisterPort(Integer registerPort) {
        this.registerPort = registerPort;
    }

    public Integer getServerPort() {
        return serverPort;
    }

    public void setServerPort(Integer serverPort) {
        this.serverPort = serverPort;
    }

    public String getServerAddress() {
        return serverAddress;
    }

    public void setServerAddress(String serverAddress) {
        this.serverAddress = serverAddress;
    }
}
